package com.xhji.web.mvc.response;


import java.util.List;

public class DefaultGenericResponse<T> implements GenericResponse<T> {
    /**
     * 状态码.
     */
    private int code;
    /**
     * 调用消息.
     */
    private String message;
    /**
     * 响应数据.
     */
    private T data;
    /**
     * 异常堆栈信息.
     */
    private String stackInfo;
    /**
     * 服务提供方返回的本次调用ID.
     */
    private String tradeId;
    /**
     * 参数校验失败时返回的详细信息.
     */
    private List<FieldError> details;

    @Override
    public boolean isSuccess() {
        return code == 200;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public void setCode(int code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public T getData() {
        return data;
    }

    @Override
    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String getStackInfo() {
        return stackInfo;
    }

    @Override
    public void setStackInfo(String stackInfo) {
        this.stackInfo = stackInfo;
    }

    @Override
    public String getTradeId() {
        return tradeId;
    }

    @Override
    public void setTradeId(String tradeId) {
        this.tradeId = tradeId;
    }

    @Override
    public List<FieldError> getDetails() {
        return details;
    }

    public void setDetails(List<FieldError> details) {
        this.details = details;
    }


}
